home *** CD-ROM | disk | FTP | other *** search
- #ifndef _STACK_H
- #define _STACK_H
-
- #include <hmatrix.h>
-
- const int MatrixStackDepth = 20;
-
- class MatrixStack {
- HMatrix stack[MatrixStackDepth];// Stack of suspended matrices
- HMatrix tos; // Current matrix
- HMatrix tosadjoint; // Adjoint of current matrix, if computed
- float tosdeterminant; // Determinant of current matrix, if computed
- int depth; // # of matrices on stack
- int adjointflag; // Is adjoint computed for CTM?
-
- void compute_adjoint(); // Recompute adjoint, determinant
-
- public:
- void init() { tos.identity(); depth = 0; adjointflag = 0; }
-
- MatrixStack() { init(); }
- MatrixStack(HMatrix &m) : tos(m) { depth = 0; adjointflag = 0; }
-
- HMatrix &ctm() { return tos; }
- HMatrix &ctmadjoint();
- float ctmdet();
- int push();
- int pop();
- };
-
- #endif /*_STACK_H*/
-